import 'package:flutter/material.dart';
import 'package:flutter_jd/routes/routing_constants.dart';
import 'package:flutter_jd/service/global_service.dart';
import 'package:flutter_jd/tools/utils/library.dart';
import 'package:flutter_jd/ui/pages/setting/out_dialog.dart';
import 'package:flutter_jd/ui/widgets/dialog/aniation_dialog.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:get/route_manager.dart';
import 'package:get/get.dart';

class SettingController extends GetxController {
  List routeList1 = [
    {'name': '账户与安全', 'page': ''},
    {'name': '设置字体大小', 'page': ''},
    {'name': '支付设置', 'page': ''},
    {'name': '我的档案', 'page': ''},
    {'name': '通用', 'page': ''},
  ];

  List routeList2 = [
    {'name': '功能实验室', 'page': ''},
    {'name': '功能反馈', 'page': FeedbackRoute},
    {'name': '关于APP', 'page': AboutRoute},
    {'name': '开发者博客', 'page': BlogRoute}
  ];

  @override
  void onInit() {
    super.onInit();
  }

  // 退出登录
  logOut() {
    GlobalConfigService globalService = Get.find();
    globalService.setLoginStatus(false);
    Utils.logOut();
    Get.back();
    Get.toNamed(LoginRoute);
  }

  // 显示退出登录对话框
  void showDialog(TransitionType type, BuildContext context) {
    showAnimationDialog(
      context: context,
      transitionType: type,
      builder: (context) {
        return Dialog(
          shape: ContinuousRectangleBorder(
            borderRadius: BorderRadius.circular(20),
          ),
          child: OutDialog(),
        );
      },
    );
  }
}
